summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-06-02 19:17:04 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-06-02 19:18:08 +1000
commit81bf568b6fa1f023bbbccee381a6deeb413578bf (patch)
tree1d6170c24e342b0bf8d8785edc1ff9c87368e168
parent99523e563d9012f0827ba261844978884adbc543 (diff)
Pad work sizes with 1, not 0
-rw-r--r--src/opencl/qclworksize.cpp3
-rw-r--r--src/opencl/qclworksize.h8
-rw-r--r--tests/auto/qcl/tst_qcl.cpp14
3 files changed, 14 insertions, 11 deletions
diff --git a/src/opencl/qclworksize.cpp b/src/opencl/qclworksize.cpp
index 3b40808..79a351a 100644
--- a/src/opencl/qclworksize.cpp
+++ b/src/opencl/qclworksize.cpp
@@ -89,18 +89,21 @@ QT_BEGIN_NAMESPACE
\fn QCLWorkSize::QCLWorkSize(size_t size)
Constructs a single-dimensional work size with width() set to \a size.
+ The height() and depth() will be set to 1.
*/
/*!
\fn QCLWorkSize::QCLWorkSize(size_t width, size_t height)
Constructs a two-dimensional work size of \a width x \a height.
+ The depth() will be set to 1.
*/
/*!
\fn QCLWorkSize::QCLWorkSize(const QSize &size)
Constructs a two-dimensional work size set to \a size.
+ The depth() will be set to 1.
*/
/*!
diff --git a/src/opencl/qclworksize.h b/src/opencl/qclworksize.h
index b1e2ca6..0c5541e 100644
--- a/src/opencl/qclworksize.h
+++ b/src/opencl/qclworksize.h
@@ -57,13 +57,13 @@ class Q_CL_EXPORT QCLWorkSize
{
public:
QCLWorkSize()
- : m_dim(1) { m_sizes[0] = 1; m_sizes[1] = 0; m_sizes[2] = 0; }
+ : m_dim(1) { m_sizes[0] = 1; m_sizes[1] = 1; m_sizes[2] = 1; }
QCLWorkSize(size_t size)
- : m_dim(1) { m_sizes[0] = size; m_sizes[1] = 0; m_sizes[2] = 0; }
+ : m_dim(1) { m_sizes[0] = size; m_sizes[1] = 1; m_sizes[2] = 1; }
QCLWorkSize(size_t width, size_t height)
- : m_dim(2) { m_sizes[0] = width; m_sizes[1] = height; m_sizes[2] = 0; }
+ : m_dim(2) { m_sizes[0] = width; m_sizes[1] = height; m_sizes[2] = 1; }
QCLWorkSize(const QSize &size)
- : m_dim(2) { m_sizes[0] = size.width(); m_sizes[1] = size.height(); m_sizes[2] = 0; }
+ : m_dim(2) { m_sizes[0] = size.width(); m_sizes[1] = size.height(); m_sizes[2] = 1; }
QCLWorkSize(size_t width, size_t height, size_t depth)
: m_dim(3)
{ m_sizes[0] = width; m_sizes[1] = height; m_sizes[2] = depth; }
diff --git a/tests/auto/qcl/tst_qcl.cpp b/tests/auto/qcl/tst_qcl.cpp
index 1837395..c0f3c4e 100644
--- a/tests/auto/qcl/tst_qcl.cpp
+++ b/tests/auto/qcl/tst_qcl.cpp
@@ -521,26 +521,26 @@ void tst_QCL::workSize()
QCLWorkSize size;
QVERIFY(size.dimensions() == 1);
QVERIFY(size.width() == 1);
- QVERIFY(size.height() == 0);
- QVERIFY(size.depth() == 0);
+ QVERIFY(size.height() == 1);
+ QVERIFY(size.depth() == 1);
QCLWorkSize size1(42);
QVERIFY(size1.dimensions() == 1);
QVERIFY(size1.width() == 42);
- QVERIFY(size1.height() == 0);
- QVERIFY(size1.depth() == 0);
+ QVERIFY(size1.height() == 1);
+ QVERIFY(size1.depth() == 1);
QCLWorkSize size2(42, 63);
QVERIFY(size2.dimensions() == 2);
QVERIFY(size2.width() == 42);
QVERIFY(size2.height() == 63);
- QVERIFY(size2.depth() == 0);
+ QVERIFY(size2.depth() == 1);
QCLWorkSize size2b(QSize(63, 42));
QVERIFY(size2b.dimensions() == 2);
QVERIFY(size2b.width() == 63);
QVERIFY(size2b.height() == 42);
- QVERIFY(size2b.depth() == 0);
+ QVERIFY(size2b.depth() == 1);
QCLWorkSize size3(42, 63, 12);
QVERIFY(size3.dimensions() == 3);
@@ -567,7 +567,7 @@ void tst_QCL::workSize()
QVERIFY(size4.dimensions() == 2);
QVERIFY(size4.width() == 42);
QVERIFY(size4.height() == 63);
- QVERIFY(size4.depth() == 0);
+ QVERIFY(size4.depth() == 1);
QVERIFY(size4.width() == size4.sizes()[0]);
QVERIFY(size4.height() == size4.sizes()[1]);